package com.zbkj.front.controller;

import com.zbkj.common.response.CommonResult;
import com.zbkj.common.response.product.ClientProductResponse;
import com.zbkj.front.service.ProductHandleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther:
 * @Date: 2024/9/14 10:54
 * @Description:
 */
@CrossOrigin("*")
@RestController
@RequestMapping("api/front/product")
@Api(tags = "收费标准(商品)服务")
public class ProductController {

    @Autowired
    private ProductHandleService productHandleService;

    @ApiOperation(value = "商品列表")
    @GetMapping(value = "/list")
    public CommonResult<List<ClientProductResponse>> list() {
        return CommonResult.success(productHandleService.list());
    }

    @ApiOperation(value = "获取充值商品集合")
    @GetMapping(value = "/getBuyProductList/{queryType}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "queryType",value = "获取商品类型 1 订阅包和流量包 2 报告包")
    })
    public CommonResult<List<ClientProductResponse>> getBuyProductList(@PathVariable("queryType") Integer queryType) {
        return CommonResult.success(productHandleService.getBuyProductList(queryType));
    }

}
